package com.xiaoai.io.bio6_chat_demo;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

/**
 *
 * @Author
 * @Date 2021-09-06 22:31
 */
public class SendMsgClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",8888);
        OutputStream os = socket.getOutputStream();
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.print("客户端：");
            String msg = sc.nextLine();
            PrintStream ps = new PrintStream(os);
            ps.println(msg);
            ps.flush();
        }
    }
}
